#include "calendar.h"
#include "ui_calendar.h"

Calendar::Calendar(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Calendar)
{
    ui->setupUi(this);
    init(QPoint(400,300),QSize(820,290));
}


 Calendar::Calendar(QPoint position,QSize size)
 {
     ui->setupUi(this);
     init(position,size);
 }
Calendar::~Calendar()
{
    delete ui;
    SAFE_DELETE_POINTER(_pCalendarWindow);
}



void Calendar::init(QPoint position,QSize size)
{
//    QString _styleBackgroud("background-color:rgb(100,100,150,255)");
//    setStyleSheet(_styleBackgroud);
    setWindowFlags(Qt::FramelessWindowHint);

    _size   = size;
    _pos    = position;
    move(_pos);
    resize(_size);
    _pCalendarWindow = new CalendarShowWindow;
    _wholeLayout.addWidget(_pCalendarWindow);
    setLayout(&_wholeLayout);

}

void Calendar::setWidth(qint32 _width)
{
    _size.setWidth(_width);
}

void Calendar::setHeight(qint32 _height)
{
    _size.setWidth(_height);
}

void Calendar::setPosition(QPoint position)
{
    _pos = position;
}

void Calendar::setSize(QSize size)
{
    _size = size;
}

void Calendar::updateUI()
{
    _pCalendarWindow->update();
}

NoteItemMap * Calendar::getItemMap()
{
    return _pCalendarWindow->getItemMap();
}

void Calendar::reloadData(QString fileName)
{
    _pCalendarWindow->reloadData(fileName);
}

void Calendar::backupData(QString fileName)
{
    _pCalendarWindow->backupData(fileName);
}
